The CasClient object contains the following methods:
The AcknowledgeAlarm method acknowledges the alarm associated with a specified point tag.
AcknowledgeAlarm(Tag As String, AlarmRecVersion As String, Comment As String)
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The tag for the point with an alarm to be acknowledged. It can be in Site.Service.PointId or Site.Service.PointId:LongId form. |
|
AlarmRecVersion |
Yes |
The current alarm record version for the tag in the CAS. |
|
Comment |
Yes |
The comment to apply. This parameter can be an empty string. |
This method has no return value, and will fail if an error occurs.
Example
The following example checks if user 'joe.bob' can acknowledge the alarm for point 'CYGDEMO.UIS.00001099:MY_LONGPOINTID', and, if so, acknowledges the alarm. To return the alarm acknowledge state, append the ;ack parameter when adding the point. See CxScript Point Properties for more information.
|
Sub
Dim bRet bRet = CasClient.CanUserAcknowledgeAlarm("CYGDEMO.UIS.00001099", "joe.bob")
Dim Points Set Points = CreateObject("CxScript.Points") Points.AddPoint("CYGDEMO.UIS:MY_LONGPOINTID;ack") Points.UpdateNow 0
Dim Point Set Point = Points.Point("CYGDEMO.UIS:MY_LONGPOINTID")
Dim AlarmRecVersion AlarmRecVersion = Point.GetAttribute("alarmrecversion")
If (bRet) Then CasClient.AcknowledgeAlarm "CYGDEMO.UIS.00001099", AlarmRecVersion, "Alarm acknowledged" Else MsgBox "User does not have the appropriate security privilege" End If
End Sub |
The CanUserAcknowledgeAlarm method returns true if the specified user has the appropriate security privilege to acknowledge alarms for a specified point.
CanUserAcknowledgeAlarm(Tag As String, UserName As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The tag for the point to be checked for security privilege. It can be in Site.Service.PointId or Site.Service.PointId:LongId form. |
|
UserName |
Yes |
The ID of the user to be checked for security privilege. |
Example
The following example checks if user 'joe.bob' can acknowledge the alarm for point 'CYGDEMO.UIS.00001099:MY_LONGPOINTID', and, if so, acknowledges the alarm. To return the alarm acknowledge state, append the ;ack parameter when adding the point. See CxScript Point Properties for more information.
|
Sub
Dim bRet bRet = CasClient.CanUserAcknowledgeAlarm("CYGDEMO.UIS.00001099", "joe.bob")
Dim Points Set Points = CreateObject("CxScript.Points") Points.AddPoint("CYGDEMO.UIS:MY_LONGPOINTID;ack") Points.UpdateNow 0
Dim Point Set Point = Points.Point("CYGDEMO.UIS:MY_LONGPOINTID")
Dim AlarmRecVersion AlarmRecVersion = Point.GetAttribute("alarmrecversion")
If (bRet) Then CasClient.AcknowledgeAlarm "CYGDEMO.UIS.00001099", AlarmRecVersion, "Alarm acknowledged" Else MsgBox "User does not have the appropriate security privilege" End If
End Sub |
The CanUserClearAlarm method returns true if the specified user has the appropriate security privilege to clear alarms for a specified point.
CanUserClearAlarm(Tag As String, UserName As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The tag for the point to be checked for security privilege. It can be in Site.Service.PointId or Site.Service.PointId:LongId form. |
|
UserName |
Yes |
The ID of the user to be checked for security privilege. |
Example
The following example checks if user 'joe.bob' can clear the alarm for point 'CYGDEMO.UIS.00001099:MY_LONGPOINTID', and, if so, clears the alarm. To return the alarm acknowledge state, append the ;ack parameter when adding the point. See CxScript Point Properties for more information.
|
Sub
Dim bRet bRet = CasClient.CanUserClearAlarm("CYGDEMO.UIS.00001099", "joe.bob")
Dim Points Set Points = CreateObject("CxScript.Points") Points.AddPoint("CYGDEMO.UIS:MY_LONGPOINTID;ack") Points.UpdateNow 0
Dim Point Set Point = Points.Point("CYGDEMO.UIS:MY_LONGPOINTID")
Dim AlarmRecVersion AlarmRecVersion = Point.GetAttribute("alarmrecversion")
If (bRet) Then CasClient.ClearAlarm "CYGDEMO.UIS.00001099", AlarmRecVersion, "Alarm cleared" Else MsgBox "User does not have the appropriate security privilege" End If
End Sub |
The CanUserDoAlarmAction method returns true if the specified user has the appropriate security privilege to do the specified alarm action for a specified point.
CanUserDoAlarmAction(Action As String, Tag As String, UserName As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Action |
Yes |
The alarm action to be checked for security privilege. This parameter can be one of the following values:
|
|
Tag |
Yes |
The tag for the point to be checked for security privilege. It can be in Site.Service.PointId or Site.Service.PointId:LongId form. |
|
UserName |
Yes |
The ID of the user to be checked for security privilege. |
Example
The following example checks if user 'joe.bob' can acknowledge the alarm for point 'CYGDEMO.UIS.00001099:MY_LONGPOINTID', and, if so, acknowledges the alarm. To return the alarm acknowledge state, append the ;ack parameter when adding the point. See CxScript Point Properties for more information.
|
Sub
Dim bRet bRet = CasClient.CanUserDoAlarmAction("ACK", "CYGDEMO.UIS.00001099", "joe.bob")
Dim Points Set Points = CreateObject("CxScript.Points") Points.AddPoint("CYGDEMO.UIS:MY_LONGPOINTID;ack") Points.UpdateNow 0
Dim Point Set Point = Points.Point("CYGDEMO.UIS:MY_LONGPOINTID")
Dim AlarmRecVersion AlarmRecVersion = Point.GetAttribute("alarmrecversion")
If (bRet) Then CasClient.DoAlarmAction "ACK", "CYGDEMO.UIS.00001099", AlarmRecVersion, "Alarm acknowledged" Else MsgBox "User does not have the appropriate security privilege" End If
End Sub |
The CanUserForceClearAlarm method returns true if the specified user has the appropriate security privilege to force clear alarms for a specified point.
CanUserForceClearAlarm(Tag As String, UserName As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The tag for the point to be checked for security privilege. It can be in Site.Service.PointId or Site.Service.PointId:LongId form. |
|
UserName |
Yes |
The ID of the user to be checked for security privilege. |
Example
The following example checks if user 'joe.bob' can force clear the alarm for point 'CYGDEMO.UIS.00001099:MY_LONGPOINTID', and, if so, force clears the alarm. To return the alarm acknowledge state, append the ;ack parameter when adding the point. See CxScript Point Properties for more information.
|
Sub
Dim bRet bRet = CasClient.CanUserForceClearAlarm("CYGDEMO.UIS.00001099", "joe.bob")
Dim Points Set Points = CreateObject("CxScript.Points") Points.AddPoint("CYGDEMO.UIS:MY_LONGPOINTID;ack") Points.UpdateNow 0
Dim Point Set Point = Points.Point("CYGDEMO.UIS:MY_LONGPOINTID")
Dim AlarmRecVersion AlarmRecVersion = Point.GetAttribute("alarmrecversion")
If (bRet) Then CasClient.ForceClearAlarm "CYGDEMO.UIS.00001099", AlarmRecVersion, "Alarm cleared" Else MsgBox "User does not have the appropriate security privilege" End If
End Sub |
The CanUserHideAlarm method returns true if the specified user has the appropriate security privilege to hide alarms for a specified point.
CanUserHideAlarm(Tag As String, UserName As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The tag for the point to be checked for security privilege. It can be in Site.Service.PointId or Site.Service.PointId:LongId form. |
|
UserName |
Yes |
The ID of the user to be checked for security privilege. |
Example
The following example checks if user 'joe.bob' can hide the alarm for point 'CYGDEMO.UIS.00001099:MY_LONGPOINTID', and, if so, hides the alarm. To return the alarm acknowledge state, append the ;ack parameter when adding the point. See CxScript Point Properties for more information.
|
Sub
Dim bRet bRet = CasClient.CanUserHideAlarm("CYGDEMO.UIS.00001099", "joe.bob")
Dim Points Set Points = CreateObject("CxScript.Points") Points.AddPoint("CYGDEMO.UIS:MY_LONGPOINTID;ack") Points.UpdateNow 0
Dim Point Set Point = Points.Point("CYGDEMO.UIS:MY_LONGPOINTID")
Dim AlarmRecVersion AlarmRecVersion = Point.GetAttribute("alarmrecversion")
If (bRet) Then CasClient.HideAlarm "CYGDEMO.UIS.00001099", AlarmRecVersion, "Alarm hidden" Else MsgBox "User does not have the appropriate security privilege" End If
End Sub |
The CanUserUnhideAlarm method returns true if the specified user has the appropriate security privilege to unhide alarms for a specified point.
CanUserUnhideAlarm(Tag As String, UserName As String) As Boolean
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The tag for the point to be checked for security privilege. It can be in Site.Service.PointId or Site.Service.PointId:LongId form. |
|
UserName |
Yes |
The ID of the user to be checked for security privilege. |
Example
The following example checks if user 'joe.bob' can unhide the alarm for point 'CYGDEMO.UIS.00001099:MY_LONGPOINTID', and, if so, unhides the alarm. To return the alarm acknowledge state, append the ;ack parameter when adding the point. See CxScript Point Properties for more information.
|
Sub
Dim bRet bRet = CasClient.CanUserUnhideAlarm("CYGDEMO.UIS.00001099", "joe.bob")
Dim Points Set Points = CreateObject("CxScript.Points") Points.AddPoint("CYGDEMO.UIS:MY_LONGPOINTID;ack") Points.UpdateNow 0
Dim Point Set Point = Points.Point("CYGDEMO.UIS:MY_LONGPOINTID")
Dim AlarmRecVersion AlarmRecVersion = Point.GetAttribute("alarmrecversion")
If (bRet) Then CasClient.UnhideAlarm "CYGDEMO.UIS.00001099", AlarmRecVersion, "Alarm unhidden" Else MsgBox "User does not have the appropriate security privilege" End If
End Sub |
The ClearAlarm method clears the alarm associated with a specified point tag.
ClearAlarm(Tag As String, AlarmRecVersion As String, Comment As String)
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The tag for the point with an alarm to be cleared. It can be in Site.Service.PointId or Site.Service.PointId:LongId form. |
|
AlarmRecVersion |
Yes |
The current alarm record version for the tag in the CAS. |
|
Comment |
Yes |
The comment to apply. This parameter can be an empty string. |
This method has no return value, and will fail if an error occurs.
Example
The following example checks if user 'joe.bob' can clear the alarm for point 'CYGDEMO.UIS.00001099:MY_LONGPOINTID', and, if so, clear the alarm. To return the alarm acknowledge state, append the ;ack parameter when adding the point. See CxScript Point Properties for more information.
|
Sub
Dim bRet bRet = CasClient.CanUserClearAlarm("CYGDEMO.UIS.00001099", "joe.bob")
Dim Points Set Points = CreateObject("CxScript.Points") Points.AddPoint("CYGDEMO.UIS:MY_LONGPOINTID;ack") Points.UpdateNow 0
Dim Point Set Point = Points.Point("CYGDEMO.UIS:MY_LONGPOINTID")
Dim AlarmRecVersion AlarmRecVersion = Point.GetAttribute("alarmrecversion")
If (bRet) Then CasClient.ClearAlarm "CYGDEMO.UIS.00001099", AlarmRecVersion, "Alarm cleared" Else MsgBox "User does not have the appropriate security privilege" End If
End Sub |
The Connect method connects the object to a service.
Connect(DomainSiteService As String)
| Parameter | Required | Description |
|---|---|---|
|
DomainSiteService |
Yes |
The [Domain]Site.Service to which to connect. A domain is optional. The service must be a valid CAS. |
Returns 0 if successful and a non-zero value if the connection failed.
Example
The following example connects the CasClient object to the CYGDEMO.CAS on domain 5410:
|
Sub CasConnect() 'Connect to a CAS Dim CasClient Set CasClient = CreateObject("CxCas.CasClient") CasClient.Connect("[5410]CYGDEMO.CAS") End Sub |
The Disconnect method disconnects from the service.
Disconnect()
Example
The following example disconnects the CasClient object from the CAS service:
|
Sub CasClient.Disconnect
End Sub |
The DoAlarmAction method performs the specified action for the alarm associated with the specified point tag.
DoAlarmAction(Action As String, Tag As String, AlarmRecVersion As String, Comment As String)
| Parameter | Required | Description |
|---|---|---|
|
Action |
Yes |
The alarm action to be checked for security privilege. This parameter can be one of the following values:
|
|
Tag |
Yes |
The tag for the point with an alarm to be acted upon. It can be in Site.Service.PointId or Site.Service.PointId:LongId form. |
|
AlarmRecVersion |
Yes |
The current alarm record version for the tag in the CAS. |
|
Comment |
Yes |
The comment to apply. This parameter can be an empty string. |
This method has no return value, and will fail if an error occurs.
Example
The following example checks if user 'joe.bob' can acknowledge the alarm for point 'CYGDEMO.UIS.00001099:MY_LONGPOINTID', and, if so, acknowledges the alarm. To return the alarm acknowledge state, append the ;ack parameter when adding the point. See CxScript Point Properties for more information.
|
Sub
Dim bRet bRet = CasClient.CanUserDoAlarmAction("ACK", "CYGDEMO.UIS.00001099", "joe.bob")
Dim Points Set Points = CreateObject("CxScript.Points") Points.AddPoint("CYGDEMO.UIS:MY_LONGPOINTID;ack") Points.UpdateNow 0
Dim Point Set Point = Points.Point("CYGDEMO.UIS:MY_LONGPOINTID")
Dim AlarmRecVersion AlarmRecVersion = Point.GetAttribute("alarmrecversion")
If (bRet) Then CasClient.DoAlarmAction "ACK", "CYGDEMO.UIS.00001099", AlarmRecVersion, "Alarm acknowledged" Else MsgBox "User does not have the appropriate security privilege" End If
End Sub |
The ForceClearAlarm method force clears the alarm associated with a specified point tag.
ForceClearAlarm(Tag As String, AlarmRecVersion As String, Comment As String)
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The tag for the point with an alarm to be cleared. It can be in Site.Service.PointId or Site.Service.PointId:LongId form. |
|
AlarmRecVersion |
Yes |
The current alarm record version for the tag in the CAS. |
|
Comment |
Yes |
The comment to apply. This parameter can be an empty string. |
This method has no return value, and will fail if an error occurs.
Example
The following example checks if user 'joe.bob' can force clear the alarm for point 'CYGDEMO.UIS.00001099:MY_LONGPOINTID', and, if so, force clears the alarm. To return the alarm acknowledge state, append the ;ack parameter when adding the point. See CxScript Point Properties for more information.
|
Sub
Dim bRet bRet = CasClient.CanUserForceClearAlarm("CYGDEMO.UIS.00001099", "joe.bob")
Dim Points Set Points = CreateObject("CxScript.Points") Points.AddPoint("CYGDEMO.UIS:MY_LONGPOINTID;ack") Points.UpdateNow 0
Dim Point Set Point = Points.Point("CYGDEMO.UIS:MY_LONGPOINTID")
Dim AlarmRecVersion AlarmRecVersion = Point.GetAttribute("alarmrecversion")
If (bRet) Then CasClient.ForceClearAlarm "CYGDEMO.UIS.00001099", AlarmRecVersion, "Alarm cleared" Else MsgBox "User does not have the appropriate security privilege" End If
End Sub |
The GetAlarmRecordId method returns the short tag, alarm record version, and value timestamp for the given point tag. If the point tag is not known to the CAS service, an empty string will be returned for the short tag.
GetAlarmRecordId(ByVal Tag As String)
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The tag for the point with an alarm to be retrieved. It can be in Site.Service.PointId or Site.Service.PointId:LongId form. |
The GetAlarmRecordId method returns the short tags, alarm record versions, and value timestamps for all points in alarm.
GetAlarmRecordIds
The GetConsoleData method returns the console text and display attributes as two 25x80 arrays of unsigned characters.
GetConsoleData(ByRef pText, ByRef pAttr) As Integer
| Parameter | Required | Description |
|---|---|---|
|
pText |
Yes |
A two-dimensional 25x80 array of console text attributes returned by this method. |
|
pAttr |
Yes |
A two-dimensional 25x80 array of console display attributes returned by this method. |
This method returns 0 if successful.
Example
The following example writes the console text and display attributes to a CSV file.
|
Sub Dim aryText, aryAttr, nRet nRet = CasClient.GetConsoleData(aryText, aryAttr)
' Write text attributes to CSV file Dim i, j, strMsg For i = 0 To UBound(aryText, 1) For j = 0 To UBound(aryText, 2) strMsg = strMsg + CStr(aryText(i, j)) + "," Next strMsg = strMsg + vbCr Next
dim fso, file Set fso = CreateObject("Scripting.FileSystemObject") Set file = fso.OpenTextFile("c:\console_text_attrs.csv", 2, True) file.WriteLine(strMsg) file.Close
strMsg = ""
' Write display attributes to CSV file For i = 0 To UBound(aryAttr, 1) For j = 0 To UBound(aryAttr, 2) strMsg = strMsg + CStr(aryAttr(i, j)) + "," Next strMsg = strMsg + vbCr Next
Set file = fso.OpenTextFile("c:\console_disp_attrs.csv", 2, True) file.WriteLine(strMsg) file.Close
MsgBox nRet End Sub |
The GetReferences method refreshes the list of services referenced by the connected service.
GetReferences()
Example
The following example refreshes the connected services:
|
Sub
CasClient.GetReferences
End Sub |
The HideAlarm method hides the alarm associated with a specified point tag.
HideAlarm(Tag As String, AlarmRecVersion As String, Comment As String)
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The tag for the point with an alarm to be hidden. It can be in Site.Service.PointId or Site.Service.PointId:LongId form. |
|
AlarmRecVersion |
Yes |
The current alarm record version for the tag in the CAS. |
|
Comment |
Yes |
The comment to apply. This parameter can be an empty string. |
This method has no return value, and will fail if an error occurs.
Example
The following example checks if user 'joe.bob' can hide the alarm for point 'CYGDEMO.UIS.00001099:MY_LONGPOINTID', and, if so, hides the alarm. To return the alarm acknowledge state, append the ;ack parameter when adding the point. See CxScript Point Properties for more information.
|
Sub
Dim bRet bRet = CasClient.CanUserHideAlarm("CYGDEMO.UIS.00001099", "joe.bob")
Dim Points Set Points = CreateObject("CxScript.Points") Points.AddPoint("CYGDEMO.UIS:MY_LONGPOINTID;ack") Points.UpdateNow 0
Dim Point Set Point = Points.Point("CYGDEMO.UIS:MY_LONGPOINTID")
Dim AlarmRecVersion AlarmRecVersion = Point.GetAttribute("alarmrecversion")
If (bRet) Then CasClient.HideAlarm "CYGDEMO.UIS.00001099", AlarmRecVersion, "Alarm hidden" Else MsgBox "User does not have the appropriate security privilege" End If
End Sub |
The UnhideAlarm method unhides the alarm associated with a specified point tag.
UnhideAlarm(Tag As String, AlarmRecVersion As String, Comment As String)
| Parameter | Required | Description |
|---|---|---|
|
Tag |
Yes |
The tag for the point with an alarm to be unhidden. It can be in Site.Service.PointId or Site.Service.PointId:LongId form. |
|
AlarmRecVersion |
Yes |
The current alarm record version for the tag in the CAS. |
|
Comment |
Yes |
The comment to apply. This parameter can be an empty string. |
This method has no return value, and will fail if an error occurs.
Example
The following example checks if user 'joe.bob' can unhide the alarm for point 'CYGDEMO.UIS.00001099:MY_LONGPOINTID', and, if so, unhides the alarm. To return the alarm acknowledge state, append the ;ack parameter when adding the point. See CxScript Point Properties for more information.
|
Sub
Dim bRet bRet = CasClient.CanUserUnhideAlarm("CYGDEMO.UIS.00001099", "joe.bob")
Dim Points Set Points = CreateObject("CxScript.Points") Points.AddPoint("CYGDEMO.UIS:MY_LONGPOINTID;ack") Points.UpdateNow 0
Dim Point Set Point = Points.Point("CYGDEMO.UIS:MY_LONGPOINTID")
Dim AlarmRecVersion AlarmRecVersion = Point.GetAttribute("alarmrecversion")
If (bRet) Then CasClient.UnhideAlarm "CYGDEMO.UIS.00001099", AlarmRecVersion, "Alarm unhidden" Else MsgBox "User does not have the appropriate security privilege" End If
End Sub |